package ro.gateway.aida.db;

import java.sql.Connection;



public class DBPersistenceManager extends PersistenceManager
{
      protected DBPersistenceToken db_token;

		public static boolean str2Bool(String s) {
			if ("Y".equals(s)) return true;
			if ("t".equals(s)) return true;
			return false;
		} 

		public static String bool2Str(boolean b) {
			if (b) return "Y";
			return "N";
		}


      public DBPersistenceManager( PersistenceToken _token )
      {
            super(_token);

            if ( _token == null
                  || !( _token instanceof DBPersistenceToken ) )
            {
                  System.err.println( _token == null ?
                        "null" : _token.getClass().getName());
                  throw new NullPointerException();
            }
            else
            {
                  this.db_token = ( DBPersistenceToken ) token;
            }
      }

      public Connection getConnection() {
            return db_token.getCFService().
                  getConnection(db_token.getPool_name());
      }
}
